<?php
require_once ($INCLUDE_PATH . "./include/WebService2Db.php");
class LeftModel {
    public function selectuser($username,$password)
    {
        $DB=new DB_MYSQL;
        $sql="SELECT *  FROM `hh_user` WHERE `account` = '".$username."' AND `password` = '".$password."'";
        $query = $DB->query_first($sql,DB);
        return $query;
    }
    public function updatauser($username,$password) {
        $now=date("Y-m-d H:i:s",time());
        $ip=DyAuth::getip();
        $DB=new DB_MYSQL;
        $DB->connect();
        $sql="update `hh_user` set `last_login`= '".$now."',`last_ip`='".$ip."' WHERE `account` = '".$username."' AND `password` = '".$password."'";
        $DB->update($sql);
        setcookie("adminname",$username);
        setcookie("adminpassword",$password);
    setcookie("adminlogintime",time());
    }
}
?>
